import request from '@/utils/request'

// 查询检验数据列表
export function listInspectionData(query) {
  return request({
    url: '/qep/inspection/data/listDTO',
    method: 'get',
    params: query
  })
}

// 查询检验数据详细
export function getInspectionData(id) {
  return request({
    url: '/qep/inspection/data/' + id,
    method: 'get'
  })
}

// 根据任务ID查询检验数据
export function listInspectionDataByTaskId(taskId) {
  return request({
    url: '/qep/inspection/data/listDTOByTaskId/' + taskId,
    method: 'get'
  })
}

// 新增检验数据
export function addInspectionData(data) {
  return request({
    url: '/qep/inspection/data',
    method: 'post',
    data: data
  })
}

// 批量新增检验数据
export function batchAddInspectionData(data) {
  return request({
    url: '/qep/inspection/data/batch',
    method: 'post',
    data: data
  })
}

// 修改检验数据
export function updateInspectionData(data) {
  return request({
    url: '/qep/inspection/data',
    method: 'put',
    data: data
  })
}

// 删除检验数据
export function delInspectionData(id) {
  return request({
    url: '/qep/inspection/data/' + id,
    method: 'delete'
  })
}

// 根据任务ID删除检验数据
export function delInspectionDataByTaskId(taskId) {
  return request({
    url: '/qep/inspection/data/task/' + taskId,
    method: 'delete'
  })
}

// 导出检验数据
export function exportInspectionData(query) {
  return request({
    url: '/qep/inspection/data/export',
    method: 'post',
    params: query,
    responseType: 'blob'
  })
}

// 导出选中的检验数据
export function exportSelectedInspectionData(query) {
  return request({
    url: '/qep/inspection/data/exportSelected',
    method: 'post',
    params: query,
    responseType: 'blob'
  })
}

// 导入检验数据
export function importInspectionData(data, taskId, updateSupport) {
  return request({
    url: '/qep/inspection/data/importData?taskId=' + taskId + '&updateSupport=' + updateSupport,
    method: 'post',
    data: data
  })
}

// 获取导入模板
export function getImportTemplate() {
  return request({
    url: '/qep/inspection/data/importTemplate',
    method: 'post'
  })
}

// 根据任务ID获取检验参数及标准值
export function getParametersByTaskId(taskId) {
  return request({
    url: '/qep/inspection/data/parameters/' + taskId,
    method: 'get'
  })
} 